<template>
	<div>
		child:
		<input type="text" v-model="message" @change="changeValue" />
		for:{{demo}}
	</div>
</template>

<script>
export default {
	inject: ['for123'],
	props: {
		value: String //v-model会自动传递一个字段为value的prop属性
	},
	data() {
		return {
			message: this.value,
			demo: this.for123
		};
	},
	methods: {
		changeValue() {
			this.$emit('input', this.message); //通过如此调用可以改变父组件上v-model绑定的值
		}
	}
};
</script>
<style scoped></style>
